package com.atguigu.common.exception;


//import com.atguigu.common.utils.DateUtil;
//import com.atguigu.common.utils.FileUtil;
//import com.spire.doc.*;
//import com.spire.doc.documents.HorizontalAlignment;
//import com.spire.doc.documents.Paragraph;
//import com.spire.doc.documents.ParagraphStyle;

import java.awt.*;
import java.io.DataInput;
import java.io.File;
import java.util.Date;

public class e {
//    public static void main(String[] args){
//        //创建Word文档
//        Document document = new Document();
//
//        document.getBuiltinDocumentProperties().setTitle("安全月报文档");
//        document.getBuiltinDocumentProperties().setSubject("Word文档属性");
//        document.getBuiltinDocumentProperties().setAuthor("kj");
//        document.getBuiltinDocumentProperties().setCompany("亚信智网科技有限公司");
//        document.getBuiltinDocumentProperties().setManager("kj");
//        document.getBuiltinDocumentProperties().setCategory("Word操作");
//        document.getBuiltinDocumentProperties().setComments("该文档仅作内部使用");
//
//        //将第一段作为标题，设置标题格式
//        ParagraphStyle titleStyle = new ParagraphStyle(document);
//        titleStyle.setName("titleStyle");
//        titleStyle.getCharacterFormat().setBold(true);
//        titleStyle.getCharacterFormat().setFontName("宋体");
//        titleStyle.getCharacterFormat().setFontSize(20f);
//        document.getStyles().add(titleStyle);
//
//        //将第一段时间，设置标题格式
//        ParagraphStyle styleTime = new ParagraphStyle(document);
//        styleTime.setName("styleTime");
//        titleStyle.getCharacterFormat().setBold(true);
//        styleTime.getCharacterFormat().setFontName("宋体");
//        styleTime.getCharacterFormat().setFontSize(8f);
//        styleTime.getCharacterFormat().setTextColor(Color.GRAY);
//        document.getStyles().add(styleTime);
//
//        //设置2标题格式
//        ParagraphStyle twoTitleStyle = new ParagraphStyle(document);
//        twoTitleStyle.setName("twoTitleStyle");
//        titleStyle.getCharacterFormat().setBold(true);
//        twoTitleStyle.getCharacterFormat().setFontName("宋体");
//        twoTitleStyle.getCharacterFormat().setFontSize(12f);
//        document.getStyles().add(twoTitleStyle);
//
//        //设置3标题格式
//        ParagraphStyle threeTitleStyle = new ParagraphStyle(document);
//        threeTitleStyle.setName("threeTitleStyle");
//        titleStyle.getCharacterFormat().setBold(true);
//        threeTitleStyle.getCharacterFormat().setFontName("宋体");
//        threeTitleStyle.getCharacterFormat().setFontSize(10f);
//        threeTitleStyle.getCharacterFormat().setTextColor(Color.black);
//        document.getStyles().add(threeTitleStyle);
//
//        //设置2标题内容格式
//        ParagraphStyle twoContentStyle = new ParagraphStyle(document);
//        twoContentStyle.setName("twoContentStyle");
//        twoContentStyle.getCharacterFormat().setBold(true);
//        twoContentStyle.getCharacterFormat().setFontName("宋体");
//        twoContentStyle.getCharacterFormat().setFontSize(16f);
//        document.getStyles().add(twoContentStyle);
//
//        //设置3标题内容格式
//        ParagraphStyle threeContentStyle = new ParagraphStyle(document);
//        threeContentStyle.setName("threeContentStyle");
//        threeContentStyle.getCharacterFormat().setBold(true);
//        threeContentStyle.getCharacterFormat().setFontName("宋体");
//        threeContentStyle.getCharacterFormat().setFontSize(13f);
//        threeContentStyle.getCharacterFormat().setTextColor(Color.black);
//        document.getStyles().add(threeContentStyle);
//
//
//        //设置段落的格式
//        ParagraphStyle style2 = new ParagraphStyle(document);
//        style2.setName("paraStyle");
//        style2.getCharacterFormat().setFontName("宋体");
//        style2.getCharacterFormat().setFontSize(10f);
//        document.getStyles().add(style2);
//
//
//        //添加一个section
//        Section section = document.addSection();
//
//        //添加三个段落至section
//        Paragraph paraTitle = section.addParagraph();
//        paraTitle.appendText("动态应用防护系统 Bot Security Guard\n" +
//                "应用安全分析报告");
//        paraTitle.applyStyle("titleStyle");
//
//        Paragraph paraTime = section.addParagraph();
//        paraTime.appendText("本报告生于"+ DateUtil.ParseFormatYmdHms(new Date()));
//        paraTime.applyStyle("styleTime");
//
//        Paragraph oneTitle = section.addParagraph();
//        oneTitle.appendText("1 概述");
//        oneTitle.applyStyle("twoTitleStyle");
//        Paragraph oneTitleone = section.addParagraph();
//        oneTitleone.appendText("1.1 本报告阅读对象");
//        oneTitleone.applyStyle("threeTitleStyle");
//        Paragraph oneTitletwo = section.addParagraph();
//        oneTitletwo.appendText("1.1 统计分析内容");
//        oneTitletwo.applyStyle("threeTitleStyle");
//        Paragraph oneTitlethree = section.addParagraph();
//        oneTitlethree.appendText("1.1 统计分析范围");
//        oneTitlethree.applyStyle("threeTitleStyle");
//
//        Paragraph twoTitle = section.addParagraph();
//        twoTitle.appendText("2 安全总览");
//        twoTitle.applyStyle("twoTitleStyle");
//        Paragraph twoTitleone = section.addParagraph();
//        twoTitleone.appendText("2.1 保护站点");
//        twoTitleone.applyStyle("threeTitleStyle");
//        Paragraph twoTitletwo = section.addParagraph();
//        twoTitletwo.appendText("2.2 请求总览");
//        twoTitletwo.applyStyle("threeTitleStyle");
//        Paragraph twoTitlethree = section.addParagraph();
//        twoTitlethree.appendText("2.3 请求趋势");
//        twoTitlethree.applyStyle("threeTitleStyle");
//
//        Paragraph threeTitle = section.addParagraph();
//        threeTitle.appendText("3 攻击情况统计");
//        threeTitle.applyStyle("twoTitleStyle");
//        Paragraph threeTitleone = section.addParagraph();
//        threeTitleone.appendText("3.1 BOT攻击类型分布");
//        threeTitleone.applyStyle("threeTitleStyle");
//        Paragraph threeTitletwo = section.addParagraph();
//        threeTitletwo.appendText("3.2 Web攻击类型分布");
//        threeTitletwo.applyStyle("threeTitleStyle");
//        Paragraph threeTitlethree = section.addParagraph();
//        threeTitlethree.appendText("3.3 来源IP统计");
//        threeTitlethree.applyStyle("threeTitleStyle");
//        Paragraph three_treeTitleone = section.addParagraph();
//        three_treeTitleone.appendText("3.3.1 Top5访问IP-时间趋势");
//        three_treeTitleone.applyStyle("threeTitleStyle");
//        Paragraph three_threeTitletwo = section.addParagraph();
//        three_threeTitletwo.appendText("3.3.2 Top5异常IP-时间趋势");
//        three_threeTitletwo.applyStyle("threeTitleStyle");
//        Paragraph three_threeTitlethree = section.addParagraph();
//        three_threeTitlethree.appendText("3.3.3 Top10异常IP统计");
//        three_threeTitlethree.applyStyle("threeTitleStyle");
//        Paragraph four_treeTitleone = section.addParagraph();
//        four_treeTitleone.appendText("3.4 Top10攻击路径统计");
//        four_treeTitleone.applyStyle("threeTitleStyle");
//        Paragraph five_treeTitleone = section.addParagraph();
//        five_treeTitleone.appendText("3.5 终端环境统计");
//        five_treeTitleone.applyStyle("threeTitleStyle");
//        Paragraph five_threeTitletwo = section.addParagraph();
//        five_threeTitletwo.appendText("3.5.1 浏览器类型");
//        five_threeTitletwo.applyStyle("threeTitleStyle");
//        Paragraph five_threeTitlethree = section.addParagraph();
//        five_threeTitlethree.appendText("3.5.2 操作系统类型");
//        five_threeTitlethree.applyStyle("threeTitleStyle");
//
//
//
//
//        Paragraph para3 = section.addParagraph();
//        para3.appendText("时维九月，序属三秋。潦水尽而寒潭清，烟光凝而暮山紫。俨骖騑于上路，访风景于崇阿；临帝子之长洲，得天人之旧馆。"+
//                "层峦耸翠，上出重霄；飞阁流丹，下临无地。鹤汀凫渚，穷岛屿之萦回；桂殿兰宫，即冈峦之体势。");
//
//
//        for(int i = 3; i <= 5; i++){
//            Paragraph para = section.getParagraphs().get(i);
//            para.getListFormat().applyBulletStyle();
////            para.getListFormat().getCurrentListLevel().setNumberPosition(-2);
//            para.getFormat().setLeftIndent(30);
//        }
//
//        for(int i = 7; i <= 9; i++){
//            Paragraph para = section.getParagraphs().get(i);
//            para.getListFormat().applyBulletStyle();
////            para.getListFormat().getCurrentListLevel().setNumberPosition(-2);
//            para.getFormat().setLeftIndent(30);
//        }
//
//        for(int i = 11; i <= 20; i++){
//            Paragraph para = section.getParagraphs().get(i);
//            para.getListFormat().applyBulletStyle();
////            para.getListFormat().getCurrentListLevel().setNumberPosition(-2);
//            if(i<=13){
//                para.getFormat().setLeftIndent(30);
//            }else if(i>=14 && i<=16){
//                para.getFormat().setLeftIndent(60);
//            }else if(i>=16 && i<=18){
//                para.getFormat().setLeftIndent(30);
//            }else{
//                para.getFormat().setLeftIndent(60);
//            }
//        }
//
//        para3.applyStyle("paraStyle");
//
//        //设置标题的对齐方式
//        paraTitle.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
//        //设置标题时间对齐方式
//        paraTime.getFormat().setHorizontalAlignment(HorizontalAlignment.Right);
//
//        //设置第二段和第三段的段首缩进
//        para3.getFormat().setFirstLineIndent(25f);
//
//        //设置第一段和第二段的段后间距
//        paraTitle.getFormat().setAfterSpacing(15f);
//        paraTime.getFormat().setAfterSpacing(30f);
//        oneTitle.getFormat().setAfterSpacing(5f);
//        twoTitle.getFormat().setAfterSpacing(5f);
//        threeTitle.getFormat().setAfterSpacing(5f);
//        five_threeTitlethree.getFormat().setAfterSpacing(25f);
//
//
//        //保存文档
//        File file = new File( "D:\\111");
//        FileUtil.judeDirExists(file);
//        document.saveToFile("D:\\111\\111.doc", FileFormat.Docx);
//    }


}



